//app.js
var qcloud = require('/vendor/wafer2-client-sdk/index');
var config = require('config');
var post = require('./utils/post.js');
App({
  onLaunch: function () {
    let that = this;
    qcloud.setLoginUrl(config.service.loginUrl)
    wx.reLaunch({
      url: '/pages/authorization/authorization',
    })
  },
  getSession : function(){
    
  },
  post : function(url,data){
    return post(this.globalData.baseUrl+url,data);
  },
  init : function(){
    let that = this;
    this.post('/shop/getShopInfo').then(res=>{
      that.globalData.shopId = res.id;
      that.globalData.shopName = res.name;
      that.globalData.shopAddress = res.address;
      that.globalData.phone = res.phone;
      that.globalData.pic = res.pic;
      that.globalData.shop_pic = res.shop_pic;
      that.globalData.version = res.version;
      that.globalData.about = res.about;
      that.globalData.new_user_rate = res.new_user_rate;
      that.globalData.sale_rate = res.sale_rate;
      that.globalData.services = res.services;
      that.globalData.privacy = res.privacy;
      that.globalData.info = res.info;
    })
  },
  globalData: {
    userInfo: null,
    baseUrl: 'https://stackapi.supergk.com/',
    baseImageUrl:'https://stackapi.supergk.com/',
    shopId:'',//店铺id
    shopName: '',//店铺名称
    shopAddress: '',//店铺地址
    sale_rate:'',//销售佣金比例
    new_user_rate:'',//新用户佣金比例
    phone: '',//电话号码
    pic: '',//店铺背景
    shop_pic:'',//店铺头像
    version: '',//版本号
    about: '',//关于我们
    services:'',//服务协议
    privacy:'',//隐私政策
    info:'',//商家信息
    newsdata: '',
    countDownNum: '',
    _pid: '',
    // 二维码
    _QRcode: '',
    _QRcodeName: ''
  }
})
